<template>
  <div ref="pie_Dom" style="width: 100%; height: 100%;">
  
  </div>
</template>

<script>
  import Drow from "@/Echarts/temperature/pie.js"
  export default {
    data() {
      return {
        data: this.$store.state.temperature.info,
        //用来记录24h类的温度的状态
        temperature_state: {
          //高温的次数
          high_temperature: 0,
          //低温的次数
          low_temperature: 0,
          //正常温度的次数
          normal_temperature: 0
        },
      };
    },
    mounted() {
      this.Finishing();
      this.Drow()
    },
    methods: {
      Drow,
      //对温度数据进行整理
      Finishing() {
        let extent = this.data.length;
        for (let i = 0; i < extent; i++) {
          let flag = this.data[i];
          flag = flag[1];
          //记录低温
          if (flag < 15) {
            this.temperature_state.low_temperature++
          } else {
            //记录正常温度的次数
            if (flag < 30 && flag >= 15) {
              this.temperature_state.normal_temperature++;
            } //记录高温的次数
            if (flag >= 30) {
              this.temperature_state.high_temperature++;
            }
          }
        }
      }
    },
    watch: {
      data() {
        this.Finishing();
        this.Drow()
      }
    }
  }
</script>

<style>
</style>
